import json


class Student:
    def __init__(self, id, number, name, sex, department, address, classes):
        self.id = id
        self.number = number
        self.name = name
        self.sex = sex
        self.department = department
        self.address = address
        self.classes = classes

    @staticmethod
    def map_to_data(inp):
        return (inp['id'], inp['number'], inp['name'], inp['sex'], inp['department'], inp['address'],
                inp['classes'])

    @staticmethod
    def result_to_json(result):
        entity = Student(result[0], result[1], result[2], result[3], result[4], result[5], result[6])
        return json.dumps(entity.__dict__)

    @staticmethod
    def result_to_entity(result):
        entity = Student(result[0], result[1], result[2], result[3], result[4], result[5], result[6])
        return entity

    @staticmethod
    def result_to_entity_dict(result):
        entity = Student(result[0], result[1], result[2], result[3], result[4], result[5], result[6])
        return entity.__dict__
